﻿#region License
/* Copyright (C) 2009 Tim Coulter
 * 
 * This file is part of ExtremeML.
 * 
 * ExtremeML is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public
 * License, as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
 * the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
*/
#endregion

using System;

namespace ExtremeML.Spreadsheet.Data
{
	#region Constructors

	/// <summary>
	/// Extends the <see cref="Uri"/> class, adding the ability to
	/// associate user-friendly display text with the contained URI.
	/// </summary>
	public class HyperlinkUri : Uri
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="HyperlinkUri"/> class based on the specified base Uri and relative Uri and display text.
		/// </summary>
		/// <param name="baseUri">A <see cref="Uri"/> A <see cref="Uri"/> that represents the base Uri.</param>
		/// <param name="relativeUri">A <see cref="Uri"/> that specifies the relative Uri to apply to the base Uri.</param>
		/// <param name="text">A <see cref="string"/> that specifies the text to display when this instance is rendered.</param>
		public HyperlinkUri(
			Uri baseUri,
			Uri relativeUri,
			string text)
			: base(baseUri, relativeUri)
		{
			if (string.IsNullOrEmpty(text)) throw new ArgumentNullException("text");

			Text = text;
		}
	
		/// <summary>
		/// Initializes a new instance of the <see cref="HyperlinkUri"/> class based on the specified base Uri and relative Uri string and display text.
		/// </summary>
		/// <param name="baseUri">A <see cref="Uri"/> A <see cref="Uri"/> that represents the base Uri.</param>
		/// <param name="relativeUri">A <see cref="string"/> that specifies the relative Uri to apply to the base Uri.</param>
		/// <param name="text">A <see cref="string"/> that specifies the text to display when this instance is rendered.</param>
		public HyperlinkUri(
			Uri baseUri,
			string relativeUri,
			string text)
			: base(baseUri, relativeUri)
		{
			if (string.IsNullOrEmpty(text)) throw new ArgumentNullException("text");

			Text = text;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="HyperlinkUri"/> class with the specified Uri and display text.
		/// This constructor allows you to specify if the Uri string is a relative Uri, absolute Uri, or is indeterminate.
		/// </summary>
		/// <param name="uriString">A <see cref="string"/> that identifies the resource to be represented by this instance.</param>
		/// <param name="uriKind">A value that specifies whether the Uri string is a relative Uri, absolute Uri, or is indeterminate.</param>
		/// <param name="text">A <see cref="string"/> that specifies the text to display when this instance is rendered.</param>
		public HyperlinkUri(
			string uriString,
			UriKind uriKind, 
			string text)
			: base(uriString, uriKind)
		{
			if (string.IsNullOrEmpty(text)) throw new ArgumentNullException("text");

			Text = text;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="HyperlinkUri"/> class with the specified Uri and display text.
		/// </summary>
		/// <param name="uriString">A <see cref="string"/>that identifies the resource to be represented by this instance.</param>
		/// <param name="text">A <see cref="string"/> that specifies the text to display when this instance is rendered.</param>
		public HyperlinkUri(
			string uriString,
			string text)
			: base(uriString)
		{
			if (string.IsNullOrEmpty(text)) throw new ArgumentNullException("text");

			Text = text;
		}




	#endregion
	#region Properties

	/// <summary>
	/// Gets or sets the text that will be displayed when this instance is rendered.
	/// </summary>
	public string Text { get; set; }

	#endregion
	}
}
